Modular Compilers Based on Monad

نویسندگان

  • William L. Harrison
  • Samuel N. Kamin
چکیده

The monadic style of language speciication has the advantages of modularity and extensibility: it is simple to add or change features in an interpreter to reeect modiications in the source language. It has proven dif-cult to extend the method to compilation. We demonstrate that by introducing machine-like stores (code and data) into the monadic semantics and then partially evaluating the resulting semantic expressions, we can achieve many of the same advantages for a compiler as for an interpreter. A number of language constructs and features are compiled: expressions, CBV and CBN evaluation of-expressions, dynamic scop-ing, and various imperative features. The treatment of recursive procedures is outlined as well. The resulting method allows compilers to be constructed in a mix-and-match fashion just as in a monad-structured interpreter.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Compilation as Metacomputation: Binding Time Separation in Modular Compilers (ex Tende D Abstract)

This paper presents a modular and extensible style of language speciication based on meta-computations. This style uses two monads to factor the static and dynamic parts of the speci-cation, thereby staging the speciication and achieving strong binding-time separation. Because metacomputations are deened in terms of monads, they can be constructed modularly and ex-tensibly using monad transform...

متن کامل

Modular Compilers Based on Monad Transformers

The monadic style of language speciication has the advantages of modularity and extensibility: it is simple to add or change features in an interpreter to reeect modiications in the source language. It has proven dif-cult to extend the method to compilation. We demonstrate that by introducing machine-like stores (code and data) into the monadic semantics and then partially evaluating the result...

متن کامل

Modular construction of Bayesian inference algorithms

We propose a set of abstractions to modularize implementation of Bayesian inference algorithms. We provide a proof-of-concept implementation as a Haskell library and demonstrate on several examples how it simplifies implementation of Monte Carlo algorithms. Our technique is based on a method for modular construction of interpreters using monad transformers and is applicable generically to proba...

متن کامل

Draft Proceedings of the 24 Th Symposium on Implementation and Application of Functional Languages ( Ifl 2012 )

Higher-order functions that are polymorphic in a monad make highly flexible modular components. Unfortunately, the combination of an unknown function parameter and a polymorphic monad are detrimental to reasoning. This paper shows how to eliminate both the function parameter and the polymorphism. The resulting characterization is amenable to reasoning. The approach is based on a judicious combi...

متن کامل

Metacomputation-Based Compiler Architecture

This paper presents a modular and extensible style of language speci cation based on metacomputations. This style uses two monads to factor the static and dynamic parts of the speci cation, thereby staging the speci cation and achieving strong binding-time separation. Because metacomputations are de ned in terms of monads, they can be constructed modularly and extensibly using monad transformer...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1998